package uilayer;

import java.awt.BorderLayout;
import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JLabel;
import javax.swing.JTextField;
import javax.swing.JButton;

import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;

public class LoginMenu extends JFrame {

	private JPanel contentPane;
	private JTextField textField;
	private JTextField textField_1;
	private String loggetInd;
	private MainMenuGUI mGUI;
	private JLabel lblNewLabel;
	

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					LoginMenu frame = new LoginMenu();
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the frame.
	 */
	public LoginMenu() {
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 292, 199);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		contentPane.setLayout(null);
		
		JLabel lblBrugernavn = new JLabel("Brugernavn");
		lblBrugernavn.setBounds(12, 16, 94, 16);
		contentPane.add(lblBrugernavn);
		
		JLabel lblPassword = new JLabel("Password");
		lblPassword.setBounds(12, 45, 94, 16);
		contentPane.add(lblPassword);
		
		textField = new JTextField();
		textField.setBounds(128, 13, 116, 22);
		contentPane.add(textField);
		textField.setColumns(10);
		
		textField_1 = new JTextField();
		textField_1.setBounds(128, 42, 116, 22);
		contentPane.add(textField_1);
		textField_1.setColumns(10);
		
		JButton btnNewButton = new JButton("Login");
		btnNewButton.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				System.out.println(textField.getText() + " " + textField_1.getText());
				if(textField.getText().equals("") || textField_1.getText().equals(""))
				{
					textField_1.setText("");
					lblNewLabel.setVisible(true);
				}
			}
		});
		btnNewButton.setBounds(12, 74, 232, 25);
		contentPane.add(btnNewButton);
		
		lblNewLabel = new JLabel("Brugernavn eller password er forkert");
		lblNewLabel.setBounds(12, 112, 232, 16);
		lblNewLabel.setVisible(false);
		contentPane.add(lblNewLabel);
	}
}
